package com.lingxu.module.risk.controller;
import com.lingxu.module.risk.entity.ModelCategory;
import com.lingxu.module.risk.service.impl.ModelCategoryService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/modelcategory")
public class ModelCategoryController {

    @Resource
    private ModelCategoryService modelCategoryService;

    @ResponseBody
    @RequestMapping("/getTopCategory")
    public List<ModelCategory> getTopCategory() {
        return modelCategoryService.getTopCategory();
    }

    @ResponseBody
    @RequestMapping("/getCategoryByPid")
    public List<ModelCategory> getCategoryByPid(String pid) {
        List<ModelCategory> result = new ArrayList<ModelCategory>();
        if(pid != null) {
            result = modelCategoryService.getCategoryByPid(pid);
        }
        return result;
    }
}
